package com.awn.weidian.demo.mapper;

import java.util.List;

import com.awn.weidian.demo.pojo.OrderOfGoods;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;


@Mapper

public interface IOrderOfGoods{


    @Insert("insert into orderofgoods (oid,buyerid,sellerid,ordertime,gid,realmoney) value (#{oid},#{buyerid},#{sellerid},#{ordertime},#{gid},#{realmoney})")
    public int addOrder(OrderOfGoods oog);

    @Select("select oid,buyerid,sellerid,date_format(ordertime,'%Y-%m-%d %h:%i:%s') as ordertime,gid,realmoney,payment,deliver,collect,orderstate,courier,buyerevaluate,sellerevaluate from orderofgoods")
    public List<OrderOfGoods> showOrder();

    @Update("update orderofgoods set payment = 1 where oid = #{oid}")
    public int updatePayment(OrderOfGoods oog);
    
    @Update("update orderofgoods set payment = 2 where oid = #{oid}")
    public int updateRefund(OrderOfGoods oog);

    @Update("update orderofgoods set payment = 3 where oid = #{oid}")
    public int updateRefunded(OrderOfGoods oog);

    @Update("update orderofgoods set payment = 4 where oid = #{oid}")
    public int updatereClose(OrderOfGoods oog);

    @Update("update orderofgoods set deliver = 1 where oid = #{oid}")
    public int updateDeliver(OrderOfGoods oog);

    @Update("update orderofgoods set collect = 1 where oid = #{oid}")
    public int updateCollect(OrderOfGoods oog);

    @Update("update orderofgoods set orderstate = 1 where oid = #{oid}")
    public int updateOrderstate(OrderOfGoods oog);

    @Update("update orderofgoods set buyerevaluate = 1 where oid = #{oid}")
    public int updateBuyerevaluate(OrderOfGoods oog);

    @Update("update orderofgoods set sellerevaluate = 1 where oid = #{oid}")
    public int updateSellerevaluate(OrderOfGoods oog);
}